<template>
  <div>
    <div class="header">
      <div class="header-left">后台管理系统</div>
      <div class="header-right">
        <el-dropdown>
          <span class="el-dropdown-link">
            {{realName}}<i class="el-icon-arrow-down el-icon--right"></i>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item><span @click="toHome">首页</span></el-dropdown-item>
            <el-dropdown-item
              ><span @click="loginOut">退出登录</span></el-dropdown-item
            >
          </el-dropdown-menu>
        </el-dropdown>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      realName: sessionStorage.getItem("realName")
    };
  },
  methods: {
    loginOut() {
      sessionStorage.clear()
      this.$router.push("/login");
    },
    toHome(){
      this.$router.push("/")
    }
  },
};
</script>
<style lang="less">
.header {
  font-size: 34px;
  height: 60px;
  background-color: rgb(9, 185, 255);
  display: flex;
  justify-content: space-between;
  line-height: 1;
}
.header-right,
.header-left {
  margin: 10px 20px;
}
.header-left {
  color: white;
  font-weight: 800;
}
.header-right {
  margin: 10px 40px 0 0;
}
.el-dropdown-link {
  cursor: pointer;
  color: #ffffff;
  font-size: 20px;
}
.el-icon-arrow-down {
  font-size: 20px;
  
}
.el-header{
  padding: 0;
}
</style>